package com.cars.springbootbeetlsql.controller;

import com.cars.springbootbeetlsql.entity.User1Entity;
import com.cars.springbootbeetlsql.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName: UserController
 * @Description: 用户控制层
 * @author: caoqianfan
 * @date: 2023/8/22 15:17
 */
@RestController
@RequestMapping("/User")
public class UserController {
    @Resource
    private UserService userService;

    @PostMapping("/insert")
    public void insert(User1Entity user1Entity) {
        userService.insert(user1Entity);
    }

    @DeleteMapping("/deleteById")
    public Integer deleteById(Integer id) {
        return userService.deleteById(id);
    }

    @PutMapping("/updateById")
    public Integer updateById(User1Entity user1Entity) {
        return userService.updateById(user1Entity);
    }

    @GetMapping("/selectByIds")
    public List<User1Entity> selectById(List<Integer> ids) {
        return userService.selectByIds(ids);
    }

    @GetMapping("/all")
    public List<User1Entity> all() {
        return userService.all();
    }

    @GetMapping("/allCount")
    public Long allCount() {
        return userService.allCount();
    }
}